package com.geen.tuoke.ui.activity

import android.annotation.TargetApi
import android.content.res.Resources
import android.os.Build
import android.os.Bundle
import android.view.WindowInsets
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.lifecycle.lifecycleScope
import com.geen.tuoke.R
import com.geen.tuoke.base.BaseActivity
import com.geen.tuoke.base.EmptyViewModel
import com.geen.tuoke.databinding.ActivitySplashBinding
import com.geen.tuoke.ui.viewmodel.SplashViewModel
import com.qmuiteam.qmui.util.QMUIStatusBarHelper
import com.seeway.wms.utils.startActivity
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import me.jessyan.autosize.internal.CancelAdapt

/**
 * @Author LuoJi
 * @Date 2022/1/17-13:28
 * @Desc
 */
class PhoneSplash : BaseActivity<SplashViewModel,ActivitySplashBinding>(),CancelAdapt{

    override fun getLayoutId(): Int {
        return R.layout.activity_splash
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        with(mBinding){
            lifecycleOwner = this@PhoneSplash
        }
        mViewModel.refreshSuccess.observe(this,{
            if(it){
                startActivity<MainActivity>()
            }else{
                startActivity<LoginActivity>()
            }
            finish()
        })
    }

    override fun getResources(): Resources {
        return getSuperResources()
    }
}